package cc.lucien.feign;

import cc.lucien.entity.Student;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

import java.util.Collection;

/**
 * @author lucien-ma
 * @date 2021/9/21
 * @apiNote
 */
// value 写在注册中心的名字即可
@FeignClient(value = "provider")
public interface FeignProviderClient {

    /**
     * 写 provider 里面的访问路径
     * @return
     */
    @GetMapping("/provider/findAll")
    Collection<Student> findAll();

    @GetMapping("/provider/findById/{id}")
    Student findById(@PathVariable("id") Integer id);

    @PostMapping("/provider/save")
    void save(@RequestBody Student student);

    @PutMapping("/provider/update")
    void update(@RequestBody Student student);

    @DeleteMapping("/provider/deleteById/{id}")
    void deleteById(@PathVariable("id") Integer id);

}
